/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.estacionamiento.vista;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author Lindemann
 */
@ManagedBean
@SessionScoped
public class accesoBean {
 //------variables(propiedades)----------------------------------------
    private String name;
    private String password;
    //-------------constructor--------------------------------------------

    public String getPassword() {
        return password;
    }
//------------metodos GET y SET-------------------------------------------

    public void setPassword(String password) {
        this.password = password;
    }

    public accesoBean() {
    }

    public String getName() {
        System.out.println("Entro al GET");
        return name;
    }

    public void setName(String name) {
        System.out.println("Entro al SET");
        this.name = name;
    }
    //------------------Acciones----------------------------
        public String validarEntrada(){//entrada en lugar de login
            if(name.equals("root") && password.equals("123")){//////////////////////no entra al metodo
                FacesContext context = FacesContext.getCurrentInstance();
            context.getExternalContext().getSessionMap().put("USUARIO_LOGUEADO", name);
            return "MenuPrincipal";
            } else{
                return "index";
            }
        }
    //-------------------Listeners---------------------------
}
